<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../lib/animate/animatenew.min.css">
</head>

<body>


    <div id="app">
        <p>组件复用有无动画</p>

        <router-link to="/list/1">第一页</router-link>
        <router-link to="/list/2">第二页</router-link>
        <router-link to="/home">回到主页</router-link>

        <transition enter-active-class="animate__animated animate__backInRight" leave-active-class="animate__animated animate__backOutDown">
            <router-view></router-view>
        </transition>

    </div>

    <template id="list">
        <div>
            <h3>我就是第{{this.$route.params.pageNum}}页</h3>
        </div>
    </template>

    <template id="home">
        <div>
            <h2>我是home</h2>
        </div>
    </template>

    <script src="../lib/Vue/vue.js"></script>
    <script src="../lib/Vue/vue-router.js"></script>
    <script>

        const router = new VueRouter({
            routes: [
                {
                    path: '/list/:pageNum',
                    component: {
                        template: '#list',
                    }
                },
                {
                    path: '/home',
                    component: {
                        template: '#home',
                    }
                }
            ],
            linkActiveClass: 'active'
        })

        var vm = new Vue({
            el: '#app',
            router
        })
    </script>
</body>

</html>